import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    busno: '',
    empname: '',
    orgname: ''
  },
  mutations: {
    setGlobalBusno (state, newValue) {
      state.busno = newValue;
    },
    setGlobalEmpname (state, newValue) {
      state.empname = newValue;
    },
    setGlobalOrgname (state, newValue) {
      state.orgname = newValue;
    }
  },
  actions: {
    updateGlobalBusno (context, newValue) {
      context.commit('setGlobalBusno', newValue);
    },
    updateGlobalEmpname (context, newValue) {
      context.commit('setGlobalEmpname', newValue);
    }
    ,
    updateGlobalOrgname (context, newValue) {
      context.commit('setGlobalOrgname', newValue);
    }
  },
  getters: {
    getGlobalBusno (state) {
      return state.busno;
    },
    getGlobalEmpname (state) {
      return state.empname;
    },
    getGlobalOrgname (state) {
      return state.orgname;
    }
  }
});
